package org.liulinlin.sejw.db;

import java.sql.*;

public class CommitedService { //extends DataAccessServiceImpl {
	private int id;
	private boolean declare;
	private boolean inspect;
	private boolean insure;
	private boolean store;
	private boolean trail;
	private String other;
	
	public CommitedService() {
		
	}
	public CommitedService(int id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from CommitedService where CS_ID = '" + id + "'");
		
			rs.next();
			this.id = id;
			declare = rs.getBoolean("CS_Declare");
			inspect = rs.getBoolean("CS_Inspect");
			insure = rs.getBoolean("CS_Insure");
			store = rs.getBoolean("CS_Store");
			trail = rs.getBoolean("CS_Trail");
			other = rs.getString("CS_Other");
			
			rs.close();
			stmt.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(int id) {
		this.id = id;
	}
	public void setDeclare(boolean declare) {
		this.declare = declare;
	}
	public void setInspect(boolean inspect) {
		this.inspect = inspect;
	}
	public void setInsure(boolean insure) {
		this.insure = insure;
	}
	public void setStore(boolean store) {
		this.store = store;
	}
	public void setTrail(boolean trail) {
		this.trail = trail;
	}
	public void setOther(String other) {
		this.other = other;
	}
	
	public int getId() {
		return id;
	}
	public boolean getDeclare() {
		return declare;
	}
	public boolean getInspect() {
		return inspect;
	}
	public boolean getInsure() {
		return insure;
	}
	public boolean getStore() {
		return store;
	}
	public boolean getTrail() {
		return trail;
	}
	public String getOther() {
		return other;
	}
}
